<template>
  <div>
    <input type="text" v-model="msg" />
    <button @click="onClick">添加</button>
    <div v-for="(item, index) in list" :key="item">{{ item }}</div>
  </div>
</template>

<script>
export default {
  name: "Test",
  data() {
    return {
      msg: "",
      list: []
    };
  },
  methods: {
    onClick() {
      this.list.push(this.msg);
      this.msg = "";
    }
  }
};
</script>

<style>
</style>



// 在这个组件中实现todolist